﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CarShop
{
    public class Truck : Vehicle  ,IDragable
    {
        //fields
        private Engine truckEngine;
        private Transmission transmission;
        private int numberOfAxes;
        private double truckWeight;
        private double totalWeight;
        private List<string> description = new List<string>();

        //constructor
        public Truck(string brand, string model, string color, int year, int speed, int price, Engine truckEngine, Transmission transmission, int axes, double truckWeight, double totalWeight)
            : base(brand, model, color, year, speed, price)
        {
            this.truckEngine = truckEngine;
            this.transmission = transmission;
            this.numberOfAxes = axes;
            this.truckWeight = truckWeight;
            this.totalWeight = totalWeight;
        }

        public Transmission Transmission
        {
            get
            {
                return this.transmission;
            }
            set
            {
                this.transmission = value;
            }
        }


        public Engine TruckEngine
        {
            get
            {
                return this.truckEngine;
            }
            set
            {
                this.truckEngine = value;
            }
        }

        public List<string> Description
        {
            get { return description; }
            set
            {
                this.description = value;
            }
        }
        public void AddComment(string extra)
        {
            this.description.Add(extra);
        }

        public override string AdditionalInfo()
        {
            StringBuilder someTruck = new StringBuilder();
            someTruck.AppendLine("Transmission: " + this.Transmission.ToString());
            someTruck.AppendLine("Number of axes: : " + this.numberOfAxes);
            someTruck.AppendLine("Truck weight: : " + this.truckWeight);
            someTruck.AppendLine("Load capacity: : " + this.totalWeight);

            return someTruck.ToString();
        }

        public double licensedWeight
        {
            get
            {
                return CalculatelicensedWeight();                  
            }
            set
            {
                this.licensedWeight = value;
            }
        }

        public double CalculatelicensedWeight()
        {
            return this.totalWeight - this.truckWeight;
        }
    }
}
